#include <iostream>
using namespace std;

class Parent
{
public:
	Parent(const char* s)
	{
		cout<<"Parent()"<<" "<<s<<endl;
	}

	~Parent()
	{
		cout<<"~Parent()"<<endl;
	}
};

class Child : public Parent
{
public:
//当父类的构造函数有参数时，需要在子类的初始化列表中显示调用，理由：父类只有有参构造
	Child() : Parent("Parameter from Child!")
	{
		cout<<"Child()"<<endl;
	}

	~Child()
	{
		cout<<"~Child()"<<endl;
	}
};


int main(int argc, char *argv[])
{
	Child child;
	return 0;
}
